from selenium.webdriver.common.by import By

from Hogwarts.Homeworks.hw0627.page_objects.base_page import BasePage


"""
PAGE：录入成员信息表单页面
"""


class AddMemberPage(BasePage):
    _INPUT_USERNAME = (By.ID, "username")
    _INPUT_ACCTID = (By.ID, "memberAdd_acctid")
    _INPUT_MAIL = (By.ID, "memberAdd_mail")
    _BTN_SAVE = (By.CSS_SELECTOR, ".js_btn_save")

    def edit_member(self):
        """
        录入成员信息
        :return:
        """
        from Hogwarts.Homeworks.hw0627.page_objects.contact_page import ContactPage

        self.find(*self._INPUT_USERNAME).send_keys("鲁班8号")
        self.find(*self._INPUT_ACCTID).send_keys("1749129516")
        self.find(*self._INPUT_MAIL).send_keys("luban8@cliff.com")
        self.find_and_click(*self._BTN_SAVE)

        return ContactPage(self.driver)
